/**
 * 
 */
package com.pd.jersey.first.client;

import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriBuilder;

import org.glassfish.jersey.client.ClientConfig;

/**
 * @author prakash
 *
 */
public class MyClient {
	public static void main(String[] args) {
		ClientConfig config = new ClientConfig();

		Client client = ClientBuilder.newClient(config);

		WebTarget target = client.target(UriBuilder.fromUri("http://localhost:8080/com.pd.jersey.first").build());

		System.out.println(target.path("rest").path("hello").request().accept(MediaType.TEXT_PLAIN).get(Response.class)
				.toString());
		System.out.println(target.path("rest").path("hello").request().accept(MediaType.TEXT_PLAIN).get(String.class));

		System.out.println(target.path("rest").path("hello").request().accept(MediaType.TEXT_XML).get(String.class));

		System.out.println(target.path("rest").path("hello").request().accept(MediaType.TEXT_HTML).get(String.class));
	}

}
